/**
 * Created by iallai on 2/1/2018.
 */

import axios from 'axios'
import {CONFIG} from '@/config/env'

let API=CONFIG.PROJECT.API;

const query = (query={page:1,size:5}) => new Promise((resolve, reject) => {


  axios.get(`${API.URL}/admin_orders`,{
    params:query
  }).then(function(res){
      if(API.isOK(res.data)){
        resolve(res.data);
      }
    })
    .catch(function(err){
      reject("网络错误");
  });



});

const get = (query={id:-1})=>new Promise((resolve, reject) => {

  query.schema_id=query.id;
  axios.get(`${API.URL}/schema/detail`,{
    params:query
  }).then(function(res){
      if(API.isOK(res.data)){
        resolve(res.data);
      }
    })
    .catch(function(err){
      reject("网络错误");
    });


});
const add = (data)=>new Promise((resolve, reject) => {

  

});

const del = (data)=>new Promise((resolve, reject) => {





});

const update= (data)=>new Promise((resolve, reject) => {




});



export {query,get,del,update,add};

